<?php use_stylesheet('/sfBootstrapAdminPlugin/css/default.css') ?>
<?php use_stylesheet('/sfBootstrapAdminPlugin/css/bootstrap.min.css') ?>
<?php use_stylesheet('jquery-ui-1.10.0.custom.min.css') ?>
<?php use_stylesheet('main.css') ?>
<?php use_javascript('bootstrap.min.js') ?>
<div id="sf_admin_container" class="container-fluid">
    <?php include_partial('global/flashes') ?>
    <h2>Listado de alumnos de <?php echo $modulo->getNombre() ?></h2>
    <div id="sf_admin_content" class="row-fluid">
        <div class="span12">
            <form method="post" action="<?php echo url_for('modulo/batchUnregistration') ?>">
                <input type="hidden" name="sf_method" value="put">
                <div class="sf_admin_form">
                    <input type="hidden" name="modulo_id" value="<?php echo $sf_request->getParameter('id') ?>" id="modulo_id">
                    <div class="tabbable">
                        <div class="tab-content" style="border-top: 1px solid #DDD;">
                            <div class="tab-pane active" id="tab_none">
                                <table class="table table-condensed table-striped">
                                    <tr class="info">
                                        <td><input type="checkbox" id="check_all" /></td>
                                        <td>APELLIDO Y NOMBRE</td>
                                        <td>CONDICIÓN</td>
                                    </tr>
                                    <?php foreach ($alumnos_inscriptos as $key => $alumno): ?>
                                        <tr>
                                            <td style="width: 24px;">
                                                <input type="checkbox" name="alumno_delete[<?php echo $alumno['id'] ?>]" />
                                            </td>
                                            <td>
                                                <?php echo htmlentities(mb_strtoupper($alumno['apellido'] . ', ' . $alumno['nombre'], 'UTF-8')) ?>
                                            </td>
                                            <td>
                                                <?php
                                                if ($alumno['condicion'] == 1) {
                                                    echo 'REGULAR';
                                                } else if ($alumno['condicion'] == 2) {
                                                    echo 'LIBRE';
                                                } else if ($alumno['condicion'] == 3) {
                                                    echo 'REGULAR ESPECIAL';
                                                } else if ($alumno['condicion'] == 4) {
                                                    echo 'RECURSANTE';
                                                }
                                                ?>
                                            </td>
                                        </tr>
                                    <?php endforeach ?>
                                </table>
                            </div>                               
                        </div>
                    </div>
                </div>
                <ul class="sf_admin_actions inline">
                    <a class="btn" href="<?php echo url_for('modulo') ?>">Listar</a>                                                
                    <li class="pull-right">
                        <button type="submit" class="btn "><i class="icon-trash"></i>&nbsp;Eliminar</button>               
                    </li>
                    <li class="pull-right">
                    </li>
                </ul>
            </form>
        </div>
    </div>
</div>
<script>
    $(function() {
        
        $('#check_all').change(function() {
           if($(this).is(':checked')) {
               $('input[type="checkbox"]').attr('checked', true);
               $('input[type="checkbox"]').parents('tr').addClass('warning');
           } else {
               $('input[type="checkbox"]').attr('checked', false);
               $('input[type="checkbox"]').parents('tr').removeClass('warning');
           }
        });
        
        $('input[type="checkbox"]').change(function() {
            if($(this).is(':checked')) {
                $(this).parents('tr').addClass('warning');
            } else {
                $(this).parents('tr').removeClass('warning');
            }
        });
        
    });
</script>